<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<%@page import="java.util.Random"%><HTML>
<HEAD>
<TITLE>后台登录</TITLE>
<LINK href="${pageContext.request.contextPath }/css/Default.css" type=text/css rel=stylesheet>
<LINK href="${pageContext.request.contextPath }/css/xtree.css" type=text/css rel=stylesheet>
<LINK href="${pageContext.request.contextPath }/css/User_Login.css" type=text/css rel=stylesheet>
<style type="text/css">
.errorMessage{
	color:red;
	font-weight: bold;
}
</style>
<script type="text/javascript" src="<%=request.getContextPath() %>/js/jquery-1.3.2.js"></script>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<META content="MSHTML 6.00.6000.16674" name=GENERATOR>
<script type="text/javascript">
function changeImage(_obj){
	  	var path='<%=request.getContextPath()%>';
		var random = Math.random(1000);
		_obj.src=path+"/AuthImage?random="+random;
	  }
function submitLogin(){
	var path='<%=request.getContextPath()%>';
	var username = document.getElementById("TxtUserName").value;
	var password = document.getElementById("TxtPassword").value;
	var validateCode = document.getElementById("validateCode").value; 
	if(username==""){
		alert("请输入用户名!");
		return;
	}
	if(password==""){
		alert("请输入密码!");
		return;
	}
	if(validateCode==""){
		alert("请输入验证码!");
		return;
	}
	$.ajax({
        type: "GET",
        url: path + "/admin/login.htm?username=" + username+"&password="+password+"&validateCode="+validateCode,
        dataType: "txt",
        success: function(returnMsg){
			if(returnMsg!=""){
			returnMsg =returnMsg.split("-");
				if(returnMsg[0]!="success"){
					alert(returnMsg[1]);
					var vcode = document.getElementById("imageAuth");
					changeImage(vcode);
				}else{
					window.location.href =path+"/admin/manager.htm";
				}
			}
        },
        error: function(){
            alert("服务器繁忙,请稍后重试!");
        }
    });
}

</script>
</HEAD>
<BODY id=userlogin_body style="text-align: center">
<form id="loginform">
<DIV></DIV>

<DIV id=user_login>
<DL>
	<DD id=user_top>
	<UL>
		<LI class=user_top_l></LI>
		<LI class=user_top_c></LI>
		<LI class=user_top_r></LI>
	</UL>
	</DD>
	<DD id="user_main">
	<UL>
		<LI class=user_main_l></LI>
		<LI class=user_main_c>
		<DIV class=user_main_box>
		<UL>
			<LI class=user_main_text>用户名：</LI>
			<LI class=user_main_input><INPUT class=TxtUserNameCssClass id=TxtUserName maxLength=20 name=username></LI>
		</UL>
		<UL>
			<LI class=user_main_text>密 码：</LI>
			<LI class=user_main_input><INPUT class=TxtPasswordCssClass id=TxtPassword type=password name=password></LI>
		</UL>
		<UL>
			<LI class=user_main_text>验证码：</LI>
			<LI class=user_main_input><INPUT  id="validateCode" type="text" name="validateCode" size="4" maxlength="4"/>&nbsp;&nbsp;&nbsp;&nbsp;<img id="imageAuth" src="<%=request.getContextPath() %>/AuthImage?random=<%= new Random(1000).nextFloat() %>" onclick="changeImage(this)" alt="看不清楚？点击换一张" style="margin:-5px 3px;"/></LI>
		</UL>
		</DIV>
		</LI>
		<LI class=user_main_r><INPUT class=IbtnEnterCssClass id=IbtnEnter style="BORDER-TOP-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-RIGHT-WIDTH: 0px;background:url(${pageContext.request.contextPath }/images/user_botton.gif)" onclick='submitLogin()' type="button"  name=IbtnEnter></LI>
	</UL>
	</DD>
	<DD id=user_bottom>
	<UL>
		<LI class=user_bottom_l></LI>
		<LI class=user_bottom_c><SPAN style="MARGIN-TOP: 40px"></SPAN></LI>
		<LI class=user_bottom_r></LI>
	</UL>
	</DD>
</DL>
</DIV>
<SPAN id=ValrUserName style="DISPLAY: none; COLOR: red"></SPAN>
<SPAN id=ValrPassword style="DISPLAY: none; COLOR: red"></SPAN>
<SPAN id=ValrValidateCode style="DISPLAY: none; COLOR: red"></SPAN>
<DIV id=ValidationSummary1 style="DISPLAY: none; COLOR: red"></DIV>

<DIV></DIV>

</FORM>
</BODY>
</HTML>
